package com.bit.cfdi.web.domain;

import static javax.persistence.GenerationType.IDENTITY;

import java.io.Serializable;
import java.util.Calendar;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Version;

@Entity
@Table(name = "email")
public class Email implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3102392200107200831L;
	
	// Fields
	private Long idEmail;
	private Contacto contacto;
	private Long tipoEmail;
	private String email;
	private Long ultimaModificacionPor;
	private Calendar fechaModificacion;

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id_email", nullable = false)
	public Long getIdEmail() {
		return this.idEmail;
	}

	public void setIdEmail(final Long idEmail) {
		this.idEmail = idEmail;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_contacto", nullable = false)
	public Contacto getContacto() {
		return this.contacto;
	}

	public void setContacto(final Contacto contacto) {
		this.contacto = contacto;
	}

	@Column(name = "tipo_email")
	public Long getTipoEmail() {
		return this.tipoEmail;
	}

	public void setTipoEmail(final Long tipoEmail) {
		this.tipoEmail = tipoEmail;
	}

	@Column(name = "email", length = 100)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(final String email) {
		this.email = email;
	}
	
	@Column(name = "ultima_modificacion_por")
	public Long getUltimaModificacionPor() {
		return this.ultimaModificacionPor;
	}

	public void setUltimaModificacionPor(final Long ultimaModificacionPor) {
		this.ultimaModificacionPor = ultimaModificacionPor;
	}

	@Column(name = "fecha_modificacion")
	@Temporal(TemporalType.TIMESTAMP)
	@Version
	public Calendar getFechaModificacion() {
		return this.fechaModificacion;
	}

	public void setFechaModificacion(final Calendar fechaModificacion) {
		this.fechaModificacion = fechaModificacion;
	}

}